﻿<cfscript>
/** 
* ORM CourseCodeRange
* 
* @hint "Hibernate persistenter t_course_range. 学院开课使用课程号码段" 
* 
*/ 

component 
	displayname="public.service.orm.senate.CourseCodeRange" 
	output=false 
	persistent=true 
	selectBeforeUpdate=true dynamicInsert=true dynamicUpdate=true 
	cacheuse="Transactional" 
	entityname="CourseCodeRange" 
	table="t_course_range"
	{
	
	property type="string" name="TriggerID" column="tr_id" fieldtype="id" generator="assigned" hint="课程号段ID";

	property type="string" name="CodePrefix" column="code_prefix" hint="课程代码前缀";

	property type="numeric" name="CodeStart" column="code_start" hint="号段起始";
	property type="numeric" name="CodeCount" column="code_count" hint="号段长度";
	property type="numeric" name="CodeNextId" column="code_nextid" hint="下一编号";

	property name="Institute" fieldtype="many-to-one" fkcolumn="institute_id" cfc="Institute"  hint="任课单位";
	
	/**
	* @hint "自定义主键规则"
	* 
	* @Institute "任课单位"
	*/
	public string function getID( required Institute ) output=false {
		
		var nextID = "TR-" & arguments.Institute.getInstituteID();
		/* 
			主键生成规则 VARCHAR(10)
			
			"TR-" + 部门代码
		*/
		return nextID;
		
	}
	
}

</cfscript>